﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace Vowei.Service.Excel
{
    public enum ST_ConnectionType
    {
        OLEDB,
        ODBC
    }

    public enum ST_CommandType
    {
        Table,
        SQL,
        Cube,
        List,
        Default
    }

    public enum ST_CredentialsMethod
    {
        None,
        Stored,
        Integrated
    }

    public class CT_Parameter
    {
        public string Name { get; set; }

        public int DataType { get; set; }
    }

    public class CT_Connection
    {
        public CT_Connection()
        {
            CredentialsMethod = ST_CredentialsMethod.Integrated;
            AlwaysUseConnectionFile = true;
        }

        public string ConnectionString { get; set; }

        [XmlIgnore]
        public ST_CommandType CommandType { get; set; }

        public CT_Parameter Parameter { get; set; }

        public string CommandText { get; set; }

        [XmlIgnore]
        public string SSOApplicationID { get; set; }

        [XmlIgnore]
        public ST_CredentialsMethod CredentialsMethod { get; set; }

        [XmlIgnore]
        public bool AlwaysUseConnectionFile { get; set; }

        [XmlIgnore]
        public string Culture { get; set; }

        [XmlAttribute(Namespace = "urn:schemas-microsoft-com:office:odc")]
        public ST_ConnectionType Type { get; set; }
    }

    [XmlRoot(Namespace = "urn:schemas-microsoft-com:office:odc")]
    public class OfficeDataConnection
    {
        public CT_Connection Connection { get; set; }
    }
}
